<template>
  <div>
    <van-list
      :finished="finished"
      @load="onLoad"
      finished-text="没有更多了"
      v-model="loading"
    >
      <follow-user
        :key="index"
        :info="item"
        :type="1"
        v-for="(item, index) in list"
      />
    </van-list>
  </div>
</template>

<script>
import FollowUser from "../../../components/follow-user/follow-user";
import { getFollowersByUser } from "../../../network/ffans";
export default {
  name: "Fans",
  props: ["id"],
  components: { FollowUser },
  computed: {},
  data() {
    return {
      list: [],
      finished: false,
      loading: false,
      page: 1,
      perPage: 10
    };
  },
  created() {},
  mounted() {},
  methods: {
    async onLoad() {
      const result = await getFollowersByUser(this.id, {
        page: this.page,
        perPage: this.perPage
      });
      // console.log(result);
      if (result.message === "OK") {
        const { results } = result.data;
        this.loading = false;
        this.page++;
        this.list.push(...results)
        if (results.length === 10) {
        } else {
          this.finished = true;
        }
      } else {
        this.$toast.fail("获取失败");
        console.log(result, "获取失败");
      }
    }
  }
};
</script>

<style scoped lang= >
</style>